package edu.xlh.travel.dao;


import edu.xlh.travel.pojo.OnlineUserInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface OnlineUserInfoDao extends JpaRepository<OnlineUserInfo,String>, JpaSpecificationExecutor<OnlineUserInfo> {

    @Query(value = "select * from t_online_user_info " +
            "WHERE if(IFNULL(?1,'') !='',name like concat('%',?1,'%'),1=1) and " +
            "if(IFNULL(?2,'') !='',logined_add like concat('%',?2,'%'),1=1) and " +
            "if(IFNULL(?3,'') !='',logined_browser like concat('%',?3,'%'),1=1) order By logined_time desc limit 0,10"
            ,nativeQuery = true )
    List<OnlineUserInfo> QueryOnlineUserByCondition(String name , String loginedAdd , String loginedBrowser);
}
